<template>
	<section>
			<!--表单查询-->
			<xietong-from1 @onSubmit="onSubmit" :componentType = "componentType" :waitType="waitType"></xietong-from1>
			<!--表格展示-->
			<xietong-table :pageSize="pageSize" :pageTotal="pageTotal" class='xie_tong_table' :tableData="tableData" :labelList = 'labelList' @gotoPage="gotoPage" @checkView = "checkView"  :type = "componentType" @checkPingjia="checkPingjia"></xietong-table>
			<!--工单详情-->
			<el-dialog center=true append-to-body=true title="工单详情" :visible.sync="dialogTableVisible" :modal=false >
		  		<xietong-detail @closeDialog="closeDialog" :formId = "formId" :taskId="taskId" :type="componentType"></xietong-detail>
			</el-dialog>
			<!--工单评分-->
			<el-dialog center=true append-to-body=true title="工单评价" :visible.sync="dialogPingjiaVisible" :modal=false>
		  		<xietong-pingjia @checkPingjia="checkPingjia" :processInstanceId = "processInstanceId" :pingjiaType = 'pingjiaType'></xietong-pingjia>
			</el-dialog>
	</section>
</template>

<script>
	import xietongTable from '../comment/xietongTable';
	import xietongFrom1 from '../comment/xietongFrom1';
	import xietongDetail from '../comment/xietongDetail';
	import xietongPingjia from '../comment/xietongPingjia';
	import {apiMyList,apiGetRole}  from '../css_img_js/xieTongApi.js'
	export default{
		components:{
			xietongTable,
			xietongFrom1,
			xietongDetail,
			xietongPingjia
		},
		data(){
			return{
				pingjiaType:'',/*评价类型*/
				dialogTableVisible:false,/*详细信息*/
				dialogPingjiaVisible:false,/*评分*/
				processInstanceId:0,
			    formId:0,
			    taskId:0,
			    pingjiaId:0,
			    componentType:'mydan',
			    formDetail:{
			    	applyPerson:'',
			    	applyThing:'',
			    	applyTime:['',''],
			    	waitType:'',
			    },
			    pageSize:"10",/*每页*/
			    pageTotal:"0",/*总数*/
			   	pageNum:'1',/*当前页*/
				waitType:[
				    	{
				    		name:'待分发',
				    		val:'daifenfa',
				    	},
				    	{
				    		name:'待反馈',
				    		val:'daifankui',
				    	},
				    	{
				    		name:'待签收',
				    		val:'daiqianshou',
				    	},
				    	{
				    		name:'待审核',
				    		val:'daishenpi',
				    	},
				    	{
				    		name:'待办结',
				    		val:'daibanjie',
				    	},
				    	{
				    		name:'待评价',
				    		val:'daipingjia',
				    	},
				    	{
				    		name:'全部',
				    		val:7,
				    	},
				],
			    tableData:[	
			    ],
			    labelList : {
				        applyTitle : '申请事项',
				        userName : '申请人员',
				        createDate : '申请时间',
				        handlers : '当前处理人',
				        arriveDate : '到达时间',
				        orderType:'分类',
				        waitType : '当前状态',
				},
			}
		},
		methods:{
			checkPingjia(val){/*查看评分,全部都是一样的评分*/
				apiGetRole(this,val);
				this.processInstanceId = val.processInstanceId
//				this.pingjiaType = val.data;
				this.dialogPingjiaVisible = true;
			},
			checkView(val){/*查看详情*/
				this.formId = val.formId;/*当前详情的id*/
				this.taskId = val.taskId;/*当前详情提交的id*/
				this.dialogTableVisible = true;
			},
			closeDialog(){
				this.dialogTableVisible = false;
			},
			onSubmit(val){/*提交查询*/
				console.log(val);
				if(val.waitType === 7){
					this.formDetail.waitType="";
					this.getList();
				}else{
					this.formDetail = val;
					this.getList();
				}
				
			},
			getList(){/*获取列表*/
				const loading = this.$loading({
				      text: '加载中',
				      target: document.querySelector('.xie_tong_table')
				    });
				apiMyList(this,this.formDetail).then(()=>{
					loading.close();
				})
			},
			gotoPage(val){/*跳页*/
				this.pageNum=val;
					this.getList();
			},
		},
		mounted(){
			this.getList();
		}
	}
</script>

<style>
</style>